package com.zy.xuanwo.zyc.portal.parser.imp;



import com.zy.xuanwo.zyc.portal.bean.DeviceControlPortal;
import com.zy.xuanwo.zyc.portal.parser.BaseParser;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * remarks:
 * Created by ChowYvlChen on 2016/7/6  16:24
 */
public class DeviceControlPortalParser extends BaseParser<DeviceControlPortal> {
    @Override
    public DeviceControlPortal parserJSON(String jsonStr) throws JSONException {
        DeviceControlPortal mDeviceControlPortal = null;
        if (super.ParseResultPoly(jsonStr) == null) {
            mDeviceControlPortal = new DeviceControlPortal();
            JSONObject mJSONObject = new JSONObject(jsonStr);
            if (mJSONObject.has("device_id")) {
                mDeviceControlPortal.setDevice_id(mJSONObject.getString("device_id"));
            }
            if (mJSONObject.has("token")) {
                mDeviceControlPortal.setToken(mJSONObject.getString("token"));
            }
        }
        return mDeviceControlPortal;
    }
}
